package com.example.elasticsearch.domain;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * 搜索中的商品信息
 *
 * @author yunda
 * @date 2021/1/25 16:57
 */
@Data
@Document(indexName = "pms", type = "product", shards = 1, replicas = 0)
public class EsProduct implements Serializable {

    private static final long serialVersionUID = -1L;

    @Id
    private
    Long id;

    /** 商品编号 */
    @Field(type = FieldType.Keyword)
    private String productSn;

    /** 品牌ID */
    private Long brandId;

    /** 品牌名称 */
    @Field(type = FieldType.Keyword)
    private String brandName;

    /** 商品分类ID */
    private Long productCategoryId;

    /** 商品分类名称 */
    @Field(type =FieldType.Keyword)
    private String productCategoryName;

    /** 商品图片 */
    private String pic;

    /** 商品名称 */
    @Field(analyzer = "ik_max_word", type = FieldType.Text)
    private String name;

    /** 商品子标题 */
    @Field(analyzer = "ik_max_word", type = FieldType.Text)
    private String subTitle;

    /** 商品关键字 */
    @Field(analyzer = "ik_max_word", type = FieldType.Text)
    private String keywords;

    /** 价格 */
    private BigDecimal price;

    /** 销量 */
    private Integer sale;

    private Integer newStatus;

    private Integer recommandStatus;

    /** 库存 */
    private Integer stock;

    /** 促销类型 */
    private Integer promotionType;

    /** 排序 */
    private Integer sort;

    /** 商品属性 */
    @Field(type = FieldType.Nested)
    private List<EsProductAttributeValue> attrValueList;

}
